﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Downplay.Gravity.Events;

namespace Downplay.Gravity.Drivers
{
    public abstract class DragHandleDriver : IDataDriver
    {
        public abstract IEnumerable<string> ForShapes();

        protected abstract string Identifier(ShapeDataContext context);

        public void ModifyDataValues(Events.ShapeDataContext context)
        {
            var dec = new ShapeDataDecoration()
            {
                DecorationMode = DataDecorationModes.AddDataWrapper
            };
            dec.Data["DragId"] = Identifier(context);
            OnModifyData(context, dec);
            context.Decorations.Add(dec);
        }

        protected abstract void OnModifyData(ShapeDataContext context, ShapeDataDecoration dec);

        public void Action(Filters.AjaxResult result, Models.GravityData data)
        {
            // TODO: Let's get action working at the drop zone. But might be nice to apply something where it's been dragged *from*, for instance handling
            // moves from one zone to another, etc., so we can ajax update the origin.
        }
    }
}